# A simple wrapper for udt.exe, just for simplifing testing
($#ARGV == 0) or die "Usage: perl test_script.pl glass \n";
$testName = $ARGV[0];
@args = ("udt", "data/train/$testName"."_uncertain.txt", "data/test/$testName"."_uncertain.txt", "output.txt");

system(@args);
open LABEL1, "output.txt";
open LABEL2, "data/test/label-$testName"."_uncertain.txt";
$size = 0;
$correct = 0;

@myLabel = <LABEL1>;
@testLabel = <LABEL2>;

for ($i = 0; $i <= $#myLabel; ++$i) {
    $size ++;
    if ($myLabel[$i] == $testLabel[$i]) {
        $correct ++;
    };
};

$precision = $correct/$size;

print "Precision $correct/$size = $precision\n";

